using Fine.Collections.Intf;



namespace Fine.Collections.Cont
{
    public class ArrStack<T> : ArrBaseCollection<T>, WStack<T>
    {

        /// <summary>
        /// Constructs an empty array-based stack.
        /// </summary>
        public ArrStack() 
            : base(1)
        {}


        public void Push(T item)
        {
            this.AddItem(item);
        }


        public T Pop()
        {
            T item = this.ExcludeLast();
            return item;
        }


        public T Top
        {
            get { return Last; }
        }


        public T Peek(int index)
        {
            int intIndex = CalcInternalIndex(lastIndex - (index - 1));
            return ar[intIndex];
        }


    }
}